<template>
	<view>
		<dsl-navbar title="企业详情" isBack bgTopImg="#ffffff" isShare='true'></dsl-navbar>
		<view class="padding bg-white">
			<view class="flex ">
				<image :src="enterpriseData.image" mode="" class="enterpris_image"></image>
				<view style="line-height: 60rpx;" class="margin-left">
					<view class="text-lg text-bold">{{enterpriseData.name}}</view>
					<view class="flex align-center">
						<view class="ont_authentication" v-if="enterpriseData.auth ==2">未认证</view>
						<view class="align-center margin-left" v-if="enterpriseData.auth ==1">
							<image src="/static/icon/imgrenzheng.png" mode="" class="icon_authentication"></image>
							<text class="text_authentication">已认证</text>
						</view>
					</view>
					<!-- <view class="fans">粉丝：3000</view> -->
				</view>
			</view>
			<view class="fans margin-top-sm">最后登录：{{enterpriseData.logintime}}</view>
		</view>
		<view class="padding margin-top-sm bg-white">
			<view class=" ">
				<picker @change="PickerChange" :value="index" :range="months">
					<view class="picker">
						{{index>-1?months[index]:'请选择'}} 月
						<text class="text-gray cuIcon-triangledownfill"></text>
					</view>
				</picker>

				<!-- <text class="text-lg text-bold">5</text> -->
				<!-- <text class="text-sm text-gray">月</text> -->
			</view>
			<view class="text-sm margin-top padding-bottom solid-bottom justify-between">
				<view>总服务费：￥{{enterpriseData.costSum}}</view>
				<view>当月服务费：￥{{enterpriseData.costMonth}}</view>
			</view>
		</view>
		<view class="enterprise_pay padding margin radius-sm text-white" v-for="(item,index) in enterpriseData.recruit"
			@click="recruit(item)">
			<view>{{item.worktype}}</view>
			<view class="margin-top">服务费：￥{{item.service || 0}}</view>
		</view>
	</view>
</template>

<script>
	import {
		enterpriseDetail
	} from '@/common/path.js'
	export default {
		data() {
			return {
				detailId: "", //企业id
				time: '',
				times: '',
				enterpriseData: {}, //企业详情
				index: -1,
				months: [
					1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
				]

			}
		},
		//生命周期函数
		onReady() {},
		onLoad(option) {
			var myDate = new Date();
			let d = myDate.getFullYear()
			let m = myDate.getMonth()
			this.detailId = option.id
			this.time = d + '-' + Number(m+1)
			this.enterpriseDetail()
		},
		onShow() {},
		methods: {
			//详情
			recruit(item) {
				uni.navigateTo({
					url: '/pages/enterprise/serviceCharge?recruit_id=' + item.id + '&time=' + this.time
				})
			},

			//根据时间筛选
			PickerChange(e) {

				var myDate = new Date();
				let d = myDate.getFullYear()
				let m = myDate.getMonth()
				this.index = e.detail.value
				this.time = d + '-' + this.months[e.detail.value] //请求接口用
				this.enterpriseDetail()
			},

			//企业详情
			enterpriseDetail() {


				let data = {
					time: this.time,
					firm_y: this.detailId,
				}
				this.Http.POST(enterpriseDetail, data).then(res => {
					if (res.code == 1) {
						// console.log('[企业详情]', res);
						this.enterpriseData = res.data
					}
				})
			}

		},
		computed: {},
		components: {}
	}
</script>

<style>
	page {
		background: #F7F6FA;
	}

	.ont_authentication {
		width: 110rpx;
		height: 38rpx;
		background: #4F96FF;
		opacity: 1;
		border-radius: 19rpx;
		line-height: 38rpx;
		text-align: center;
		color: white;
	}

	.icon_authentication {
		width: 30rpx;
		height: 30rpx;
	}

	.text_authentication {
		font-size: 20rpx;
		font-family: PingFang SC;
		color: #4F96FF;
		margin-left: 10rpx;
	}

	.enterpris_image {
		width: 175rpx;
		height: 175rpx;
		background-color: #EEEEEE;
		border-radius: 99rpx;
	}

	.fans {
		font-size: 20rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #999999;
		opacity: 1;
	}

	.enterpris_table {
		height: 36rpx;
		background: #EEEEEE;
		opacity: 1;
		border-radius: 6rpx;
		line-height: 36rpx;
		text-align: center;
		padding: 0rpx 20rpx;
		font-size: 20rpx;
		margin-right: 20rpx;
		margin-top: 20rpx;
	}

	.post_image {
		width: 62rpx;
		height: 62rpx;
		background: #00D88F;
		border-radius: 10rpx;
	}

	.enterprise_pay {
		background: #4F96FF;
	}
</style>
